import time


def my_decorator(func):
    def wrapper(number):
        print("wrapper函数开始")
        start_time = time.perf_counter()
        func(number)
        end_time = time.perf_counter()
        print(f"函数运行时间：{end_time - start_time}")
        print("wrapper函数结束")
    return wrapper

@my_decorator
def for_loop(number):
    print("for_loop函数开始")
    for i in range(number):
        pass
    print("for_loop函数结束")

@my_decorator
def while_loop(number):
    print("while_loop函数开始")
    i = 0
    while i < number:
        i+=1
    print("while_loop函数结束")

# new_for = my_decorator(for_loop)  # wapper
# new_for(100000) # wapper(100000)
for_loop(100000)

# new_while = my_decorator(while_loop)
# new_while()
while_loop(100000)



